from django.urls import path, include
from rest_framework.routers import DefaultRouter
from apps.users.views import (
    LoginView,
    MyTokenRefreshView,
    PermissionView,
    RoleViewSet,
    RolePermissionViewSet,
    UserViewSet,
    UserRegister
)


router = DefaultRouter()
router.register('permission', PermissionView)
router.register('role', RoleViewSet)
router.register('role_permission', RolePermissionViewSet)
router.register('users', UserViewSet)
router.register('register', UserRegister)

urlpatterns = [
    path('user/login/', LoginView.as_view(), name='login'),
    path('token/refresh/', MyTokenRefreshView.as_view(), name='token_refresh'),
    path('user/', include(router.urls), name='user')
]
